﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using DingHeng.TransportationManagement.Entity;

namespace DingHeng.TransportationManagement.DataAccess
{
    public class VehicleDispatchFormInfoDataAccess:IDisposable
    {
        private DAOBase<VehicleDispatchFormInfo> vehicleDispatchFormInfoDao;

        public IQueryable<VehicleDispatchFormInfo> LoadByCondition(Expression<Func<VehicleDispatchFormInfo, bool>> condition)
        {
            if (vehicleDispatchFormInfoDao == null)
            {
                vehicleDispatchFormInfoDao = new DAOBase<VehicleDispatchFormInfo>();
            }
            return vehicleDispatchFormInfoDao.LoadByCondition(condition);
        }
        public List<VehicleDispatchFormInfo> GetPageList(IQueryable<VehicleDispatchFormInfo> list, Pager<VehicleDispatchFormInfo> pagerCondition)
        {
            if (vehicleDispatchFormInfoDao == null)
            {
                vehicleDispatchFormInfoDao = new DAOBase<VehicleDispatchFormInfo>();    
            }
            vehicleDispatchFormInfoDao.GetPagerList(list, pagerCondition);
            return pagerCondition.CurrentPageList.ToList();
        }
        #region IDisposable 成员

        public void Dispose()
        {
            if (vehicleDispatchFormInfoDao != null)
            {
                vehicleDispatchFormInfoDao.Dispose();
            }
        }

        #endregion
    }
}
